﻿@model Jb.Web.ViewModels.ContentViewModel
@using Jb.Web.Utility;

@{
    String pageTitle = "Edit Content";
    if (Model != null && Model.ID == 0)
    {
        pageTitle = "Add New Content";
    }
    ViewBag.Title = Html.GetPageTitle(pageTitle);
    ViewData[AppConstants.ViewDataKeys.SELECTED_MENU] = AdminMenu.ManageContents;
    bool _HasSaved = ViewData.HasSaved();
}

<div class="jb-page-heading">
    <h1>@pageTitle</h1>
    <div>Enter necessary information and then click the Save button.</div>
</div>
<div class="jb-page-content">
@using (Html.BeginForm())
{
    @Html.ValidationSummary(false)

    if (Model == null)
    {
        @: @Html.WarningMessageBox("Sorry! Requested Content was not found for edit.")
    }
    else
    {
        if (_HasSaved)
        {
            @Html.SuccessMessageBox("Congratulations! The Content saved successfully. <a href='/Admin/Content/Edit' class='btn btn-mini'>Add New Content</a>")
        }
        else if (ViewData[AppConstants.ViewDataKeys.SAVED] != null && !_HasSaved)
        {
            @Html.WarningMessageBox("Sorry! we could not save the Content.")
        }
		@Html.HiddenFor(model => model.ID)

		<div class="editor-label">
			@Html.LabelFor(model => model.Title)
		</div>
		<div class="editor-field">
			@Html.TextBoxFor(model => model.Title, new { @class = "jb-long-text"})
			@Html.ValidationMessageFor(model => model.Title)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.Description)
		</div>
		<div class="editor-field">
            <div class="jb-label-hint">
                If you want to create paragraph in your Content Description then, hit the "Enter" button 
                in your keyboard to start a new line, then start typing a new paragraph.
            </div>
			@Html.TextAreaFor(model => model.Description, new { @class="jb-long-text"})
			@Html.ValidationMessageFor(model => model.Description)
		</div>
		@*<div class="editor-label">
			@Html.LabelFor(model => model.Summery)
		</div>
		<div class="editor-field">
			@Html.TextBoxFor(model => model.Summery)
			@Html.ValidationMessageFor(model => model.Summery)
		</div>*@
		
	    @*<div class="editor-label">
			@Html.LabelFor(model => model.Thumbnail)
		</div>
		<div class="editor-field">
			@Html.TextBoxFor(model => model.Thumbnail)
			@Html.ValidationMessageFor(model => model.Thumbnail)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.Picture)
		</div>*@
		<div class="editor-field">
            <div class="jb-label-hint">Feature to add picture in a content is coming soon.</div>
			@*@Html.TextBoxFor(model => model.Picture)
			@Html.ValidationMessageFor(model => model.Picture)*@
		</div>
        
		<div class="jb-button-container">
			<button class="btn btn-primary" type="submit" data-loading-text="Saving..."><i class="icon-hdd icon-white"></i> Save</button> 
			@Html.AdminLink("Back to Content List", "List", "Content", new { @class = "btn" })
		</div>		
    }
}
</div>
@section JavaScriptPlaceHolder
{
@Html.JavaScript("jquery.validate.min.js", Url)
@Html.JavaScript("jquery.validate.unobtrusive.min.js", Url)
}

